package com.app.reptile.base;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Objects;
import java.util.Properties;

/**
 * 系统全局配置
 */
public class AppConfig {

    //全局配置
    public static Properties CONFIG = new Properties();
    private static Logger LOG = LoggerFactory.getLogger(AppConfig.class);
    static {
        String dir = System.getProperty("user.dir");
        File file = new File(dir,"config/quartz.properties");
        InputStream inStream = null;
        try {
            if (file.exists()){
                inStream = new FileInputStream(file);
            }else{
                inStream = AppConfig.class.getResourceAsStream("/quartz.properties");
            }
            CONFIG.load(inStream);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        LOG.info("加载全局配置完成:{}",CONFIG);
    }
    //数据路径
    public final static String PATH = CONFIG.getProperty("data.path","\\data\\reptile\\");
}
